<template>
  <div>
    <!-- 自助装机页面 -->
    <div class="item">
      <self
        v-for="item in productList"
        :key="item.id"
        :pic="'https://img14.360buyimg.com/n2/' + item.imageUrl"
        :section="item.wareName"
        :price="item.price[0]"
        :stock="item.stock"
      ></self>
    </div>
  </div>
</template>

<script>
import Self from '@/components/Self.vue'
// import myaxios from './http/MyAxios'
import { selfInstalled } from '../../api/self.js'
export default {
  components: { Self },
  data() {
    return {
      productList: [],
    }
  },
  methods: {
    getS() {
      const params = { catid: 678, current: 1 }
      selfInstalled(params)
        .then(res => {
          console.log(res)
          this.productList = res.data
          this.productList.forEach((v, i) => {
            this.productList[i].price = v.dredisprice.split('.')
          })
          console.log(this.productList);
        })
        .catch(() => {})
    }
  },

  created() {
    this.getS()
  }
}
</script>

<style lang="less" scoped>
div {
  overflow: hidden;
  >.item {
    width: 100vw;
    padding: 13.6vw 0 0 23.47vw;
  }
}
</style>
